{include file="public/layout" /}
<body class="eyou_body_xin">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="store/left" /}
<div id="geduan_div" class="h15"></div>
<div class="page" style="min-width:auto;margin-left:115px;padding-bottom: 15px;">
    <!-- <div class="fixed-bar">
        <div class="item-title mb0">
            <a class="back_xin" href="javascript:history.back();"  title="返回"><i class="iconfont e-fanhui"></i></a>
            <div class="subject">
                <h3>基础配置</h3>
                <h5></h5>
            </div>
        </div>
    </div> -->
    <form class="mt15" method="post" id="handlepost" action="{:url('Store/m_conf')}" enctype="multipart/form-data" name="form1">
        <div class="ncap-form-default flexigrid htitx">
            <div class="hDiv"> <div class="hDivBox" style="height: 36px; padding-left: 10px; line-height: 36px;">商城设置</div> </div>
            <dl class="row">
                <dt class="tit"> <label>小程序商城</label> </dt>
                <dd class="opt">
                    <label class="curpoin"><input id="web_status_wx0" name="web[web_status_wx]" value="0" type="radio" {if condition="!isset($global.web_status_wx) OR empty($global.web_status_wx)"} checked="checked"{/if}>开启</label>
                    &nbsp;
                    <label class="curpoin"><input id="web_status_wx1" name="web[web_status_wx]" value="1" type="radio" {if condition="isset($global.web_status_wx) AND $global.web_status_wx eq 1"} checked="checked"{/if}>关闭</label>
                    <input type="hidden" id="old_web_status_wx" value="{$global.web_status_wx|default='0'}">
                    <p class="notic">关闭后，商城将无法访问</p>
                </dd>
            </dl>
            <div id="div_web_status_close_wx" class="{if condition='!isset($global.web_status_wx) OR empty($global.web_status_wx)'}none{/if}">
                <dl class="row">
                    <dt class="tit"> <label for="web_status_mode_wx">&nbsp;</label> </dt>
                    <dd class="opt">
                        <label class="curpoin">
                            <input type="radio" name="web[web_status_mode_wx]" value="0" {if condition='empty($global.web_status_mode_wx)'}checked="checked"{/if}/>文案显示&nbsp;&nbsp;
                        </label>
                        <label class="curpoin">
                            <input type="radio" name="web[web_status_mode_wx]" value="2" {if condition='!empty($global.web_status_mode_wx) && 2 == $global.web_status_mode_wx'}checked="checked"{/if}/>小程序模板页面&nbsp;&nbsp;
                        </label>
                    </dd>
                </dl>
                <dl class="row dl_web_status_mode_wx {if condition='!empty($global.web_status_mode_wx)'}none{/if}" id="dl_web_status_mode_wx_0">
                    <dt class="tit"> <label for="web_status_text_wx">&nbsp;</label> </dt>
                    <dd class="opt">
                        <input id="web_status_text_wx" name="web[web_status_text_wx]" value="{if condition='!isset($global.web_status_text_wx)'}暂时关闭，维护中……{else /}{$global.web_status_text_wx}{/if}" class="input-txt" type="text" autocomplete="off" />
                        <p class="notic"></p>
                    </dd>
                </dl>
                <dl class="row dl_web_status_mode_wx {if condition='empty($global.web_status_mode_wx) || 2 != $global.web_status_mode_wx'}none{/if}" id="dl_web_status_mode_wx_2">
                    <dt class="tit"> <label for="web_status_tpl_wx">&nbsp;</label> </dt>
                    <dd class="opt">
                        <input id="web_status_tpl_wx" name="web[web_status_tpl_wx]" value="{$global.web_status_tpl_wx|default=''}" class="input-txt" type="text" placeholder="关闭后，访问小程序显示的自定义页面，/pages/close/index" autocomplete="off"/>
                        <p class="notic">静态模板路径前面不要带有子目录</p>
                    </dd>
                </dl>
            </div>
            <dl class="row">
                <dt class="tit"> <label>h5商城</label> </dt>
                <dd class="opt">
                    <label class="curpoin"><input id="web_status_m0" name="web[web_status_m]" value="0" type="radio" {if condition="!isset($global.web_status_m) OR empty($global.web_status_m)"} checked="checked"{/if}>开启</label>
                    &nbsp;
                    <label class="curpoin"><input id="web_status_m1" name="web[web_status_m]" value="1" type="radio" {if condition="isset($global.web_status_m) AND $global.web_status_m eq 1"} checked="checked"{/if}>关闭</label>
                    <input type="hidden" id="old_web_status_m" value="{$global.web_status_m|default='0'}">
                    <p class="notic">关闭后，商城将无法访问</p>
                </dd>
            </dl>
            <div id="div_web_status_close_m" class="{if condition='!isset($global.web_status_m) OR empty($global.web_status_m)'}none{/if}">
                <dl class="row">
                    <dt class="tit"> <label for="web_status_mode_m">&nbsp;</label> </dt>
                    <dd class="opt">
                        <label class="curpoin">
                            <input type="radio" name="web[web_status_mode_m]" value="0" {if condition='empty($global.web_status_mode_m)'}checked="checked"{/if}/>文案显示&nbsp;&nbsp;
                        </label>
                        <label class="curpoin">
                            <input type="radio" name="web[web_status_mode_m]" value="1" {if condition='!empty($global.web_status_mode_m) && 1 == $global.web_status_mode_m'}checked="checked"{/if}/>跳转链接&nbsp;&nbsp;
                        </label>
                        <label class="curpoin">
                            <input type="radio" name="web[web_status_mode_m]" value="2" {if condition='!empty($global.web_status_mode_m) && 2 == $global.web_status_mode_m'}checked="checked"{/if}/>html模板页面&nbsp;&nbsp;
                        </label>
                    </dd>
                </dl>
                <dl class="row dl_web_status_mode_m {if condition='!empty($global.web_status_mode_m)'}none{/if}" id="dl_web_status_mode_m_0">
                    <dt class="tit"> <label for="web_status_text_m">&nbsp;</label> </dt>
                    <dd class="opt">
                        <input id="web_status_text_m" name="web[web_status_text_m]" value="{if condition='!isset($global.web_status_text_m)'}网站暂时关闭，维护中……{else /}{$global.web_status_text_m}{/if}" class="input-txt" type="text" autocomplete="off" />
                        <p class="notic"></p>
                    </dd>
                </dl>
                <dl class="row dl_web_status_mode_m {if condition='empty($global.web_status_mode_m) || 1 != $global.web_status_mode_m'}none{/if}" id="dl_web_status_mode_m_1">
                    <dt class="tit"> <label for="web_status_url_m">&nbsp;</label> </dt>
                    <dd class="opt">
                        <input id="web_status_url_m" name="web[web_status_url_m]" value="{$global.web_status_url_m|default=''}" class="input-txt" type="text" placeholder="关闭后，访问网站跳转的URL，http://" autocomplete="off"/>
                        <p class="notic">如果设置跳转URL，必须带有http:// 或 https://</p>
                    </dd>
                </dl>
                <dl class="row dl_web_status_mode_m {if condition='empty($global.web_status_mode_m) || 2 != $global.web_status_mode_m'}none{/if}" id="dl_web_status_mode_m_2">
                    <dt class="tit"> <label for="web_status_tpl_m">&nbsp;</label> </dt>
                    <dd class="opt">
                        <input id="web_status_tpl_m" name="web[web_status_tpl_m]" value="{$global.web_status_tpl_m|default=''}" class="input-txt" type="text" placeholder="关闭后，访问网站显示的自定义页面，public/close_m.html" autocomplete="off"/>
                        <p class="notic">静态模板路径前面不要带有子目录</p>
                    </dd>
                </dl>
            </div>
            <dl class="row">
                <dt class="tit"> <label for="web_logo_m">商城Logo</label> </dt>
                <dd class="opt">
                    <div class="input-file-show div_web_logo_m">
                        <span class="show">
                            <a id="img_a_web_logo_m" class="nyroModal" rel="gal" href="{$global.web_logo_m|default='javascript:void(0);'}" target="_blank">
                                <i id="img_i_web_logo_m" class="fa fa-picture-o" {notempty name="$global.web_logo_m"}onmouseover="layer_tips=layer.tips('<img src={$global.web_logo_m|default=''} class=\'layer_tips_img\'>',this,{tips: [1, '#fff']});"{/notempty} onmouseout="layer.close(layer_tips);"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="web_logo_m" name="web[web_logo_m]" value="{$global.web_logo_m|default=''}" class="type-file-text" autocomplete="off">
                            <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','allimg','web_logo_m_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <p class="notic">默认商城LOGO，通用头部显示，显示尺寸以模板设计为主</p>
                </dd>
            </dl>
            <dl class="row none">
                <dt class="tit">
                    <label for="web_basehost_m">网站网址</label>
                </dt>
                <dd class="opt">
                    <input id="web_basehost_m" name="web[web_basehost_m]" value="{$global.web_basehost_m|default=''}" placeholder="{$Request.scheme}://" class="input-txt" type="text" />
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_title_m">首页标题</label>
                </dt>
                <dd class="opt ui-web_title ui-text">
                    <input id="web_title_m" name="web[web_title_m]" value="{$global.web_title_m|default=''}" class="input-txt ui-input" type="text" data-num="80" />
                    <p class="notic">一般不超过80个字符</p>
                    <p class="ui-big-text none">一般不超过80个字符（<span class="ui-textTips">还可以输入80个字符</span>）</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_keywords_m">首页关键词</label>
                </dt>
                <dd class="opt ui-keyword ui-text">
                    <input id="web_keywords_m" name="web[web_keywords_m]" value="{$global.web_keywords_m|default=''}" class="input-txt ui-input" type="text" data-num="100" />
                    <p class="notic">一般不超过100个字符</p>
                    <p class="ui-big-text none">一般不超过100个字符（<span class="ui-textTips">还可以输入100个字符</span>）</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_description_m">首页描述</label>
                </dt>
                <dd class="opt ui-web_description ui-text">
                    <textarea rows="5" cols="60" id="web_description_m" name="web[web_description_m]" style="height:60px;" class="ui-input" data-num="200">{$global.web_description_m|default=''}</textarea>
                    <p class="notic">建议不超过200个字符</p>
                    <p class="ui-big-text none">建议不超过200个字符（<span class="ui-textTips">还可以输入200个字符</span>）</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit"> <label>技术支持</label> </dt>
                <dd class="opt">
                    <label class="curpoin"><input id="web_technology_m0" name="web[web_technology_m]" value="0" type="radio" {if condition="!isset($global.web_technology_m) OR empty($global.web_technology_m)"} checked="checked"{/if}>开启</label>
                    &nbsp;
                    <label class="curpoin"><input id="web_technology_m1" name="web[web_technology_m]" value="1" type="radio" {if condition="isset($global.web_technology_m) AND $global.web_technology_m eq 1"} checked="checked"{/if}>关闭</label>
                    <p class="notic"></p>
                </dd>
            </dl>
            <div class="bot"> <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" onclick="formSubmit();">确认提交</a> </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    $(function() {
        tipsText();

        // 关闭小程序站点
        $('input[name="web[web_status_wx]"]').click(function(){
            $('#div_web_status_close_wx').hide();
            if ($(this).val() == 1) {
                $('#div_web_status_close_wx').show();
            }
        });

        $('input[name="web[web_status_mode_wx]"]').click(function(){
            var web_status_mode_wx = $(this).val();
            $('.dl_web_status_mode_wx').hide();
            $('#dl_web_status_mode_wx_'+web_status_mode_wx).show();
        });

        // 关闭h5站点
        $('input[name="web[web_status_m]"]').click(function(){
            $('#div_web_status_close_m').hide();
            if ($(this).val() == 1) {
                $('#div_web_status_close_m').show();
            }
        });

        $('input[name="web[web_status_mode_m]"]').click(function(){
            var web_status_mode_m = $(this).val();
            $('.dl_web_status_mode_m').hide();
            $('#dl_web_status_mode_m_'+web_status_mode_m).show();
        });
    });

    function formSubmit(){
        if($('input[name="web[web_status_wx]"]:checked').val() == 1){
            var web_status_mode_wx = $('input[name="web[web_status_mode_wx]"]:checked').val();
            if(web_status_mode_wx == 1){
                if ($.trim($('input[name="web[web_status_url_wx]"]').val()) == '') {
                    showErrorMsg('跳转的URL不能为空！');
                    $('input[name="web[web_status_url_wx]"]').focus();
                    return false;
                } else if (!checkURL($('input[name="web[web_status_url_wx]"]').val())) {
                    showErrorMsg('跳转的URL格式不正确！');
                    $('input[name="web[web_status_url_wx]"]').focus();
                    return false;
                }
            }
        }
        if($('input[name="web[web_status_m]"]:checked').val() == 1){
            var web_status_mode_m = $('input[name="web[web_status_mode_m]"]:checked').val();
            if(web_status_mode_m == 1){
                if ($.trim($('input[name="web[web_status_url_m]"]').val()) == '') {
                    showErrorMsg('跳转的URL不能为空！');
                    $('input[name="web[web_status_url_m]"]').focus();
                    return false;
                } else if (!checkURL($('input[name="web[web_status_url_m]"]').val())) {
                    showErrorMsg('跳转的URL格式不正确！');
                    $('input[name="web[web_status_url_m]"]').focus();
                    return false;
                }
            }
        }
        layer_loading('正在处理');
        $.ajax({
            type : 'post',
            url : "{:url('Store/m_conf', ['_ajax'=>1])}",
            data : $('#handlepost').serialize(),
            dataType : 'json',
            success : function(res){
                layer.closeAll();
                if(res.code == 1){
                    layer.msg(res.msg, {time: 1000}, function(){
                        window.location.reload();
                    });
                }else{
                    showErrorMsg(res.msg);
                }
            },
            error: function(e){
                layer.closeAll();
                showErrorAlert(e.responseText);
            }
        });
    }

    //网站logo 回调
    function web_logo_m_call_back(fileurl_tmp)
    {
        $("#web_logo_m").val(fileurl_tmp);
        $("#img_a_web_logo_m").attr('href', fileurl_tmp);
        $("#img_i_web_logo_m").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
    }

</script>

{include file="public/footer" /}
